﻿using System;
using System.Threading;
using Zeus.Thunder.Core;

namespace SharpTrainer.Threads
{
    class CreateMultiThreadTest : ITestCase
    {
        public void Run()
        {
            Thread dedicatedThread;
            for (int i = 1; i <= 5; i++)
            {
                Console.WriteLine("Start A Thread");

                dedicatedThread = new Thread(ThreadWorker);
                dedicatedThread.Start(i);

                //dedicatedThread.Join();  // Wait for thread to terminate
            }
            
            Console.ReadLine();
        }

        private void ThreadWorker(Object threadNo)
        {
            Console.WriteLine("Thread Worker {0} Start Working...", threadNo);
            Thread.Sleep(10000);  //Simulate 10 seconds work
            Console.WriteLine("Thread Worker {0} End Working...", threadNo);
        }
    }
}
